#!/usr/bin/env python
# -*- coding:utf-8 -*-
import copy
from django.template import Library
from django.conf import settings

register = Library()


@register.inclusion_tag('tags/menu_list.html')
def menu_list(request):
    menus = copy.deepcopy(settings.FIVE_MENU_LIST)
    for item in menus:
        if not request.path_info.startswith(item['src']):
            continue
        item['class'] = 'active'
    return {'menus': menus}


@register.inclusion_tag('tags/mine_menu_list.html')
def mine_menu_list(request):
    menus = copy.deepcopy(settings.MINE_MENU_LIST)
    for item in menus:
        if not request.path_info.startswith(item['src']):
            continue
        item['class'] = True
    return {'menus': menus}
